package com.tedu.controller;

import com.tedu.pojo.Item;
import com.tedu.pojo.ItemDesc;
import com.tedu.servies.ItemDescServies;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


@Controller
public class ItemDescController {

    @Autowired
    ItemDescServies itemDescServies;

    @RequestMapping("/toItemInfo")
    public String toItemInfo(@RequestParam(value = "id",required = false,defaultValue = "0") String id,
                             Model model){

        Item itemDesc = itemDescServies.getItemById(id);
        System.out.println(id);
        model.addAttribute("pdItem",itemDesc);
        System.out.println(itemDesc);
        return "product_details";
    }
}
